package com.itheima.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

@Mapper
public interface OrderSettingMapper {
    /**
     * 根据预约日期查询预约人数是否设置
     * @param orderDate
     * @return
     */
    @Select("select number from itcast_health.t_ordersetting where orderDate=#{orderDate}")
    Integer getNumberByOrderDate(Date orderDate);

    /**
     * 根据预约日期给预约人数加一
     * @param orderDate
     */
    @Select("update itcast_health.t_ordersetting set reservations = reservations + 1 where orderDate=#{orderDate}")
    void editReservationByOrderDate(Date orderDate);

    /**
     * 根据预约日期查询已预约人数
     * @param orderDate
     * @return
     */
    @Select("select reservations from itcast_health.t_ordersetting where orderDate=#{orderDate}")
    Integer getOrderReservationsByOrderDate(Date orderDate);
}
